<template>
	<view class="">
		<u-toast ref="uToast" />
		<u-card title="正在占座"  margin="20rpx 30rpx 30rpx 20rpx">
			<view slot="body" v-for="(item,index) in logList" :key="index">
				<view class="u-body-item u-flex u-border-bottom u-col-between u-p-t-0">
					<view class="u-body-item-title" >
						<view class="">
							创建时间：{{item.createTime | date('yyyy-mm-dd hh:MM:ss')}}	
						</view>	
						<view class="">
							教室名：{{item.roomName}}
						</view>
						<view class="">
							位置：{{item.place.split(',')[1]}}排{{item.place.split(',')[1]}}列
						</view>
						<view class="">
							开始时间：{{item.startTime | date('yyyy-mm-dd hh:MM:ss')}}
						</view>
						<view class="">
							结束时间：{{item.endTime | date('yyyy-mm-dd hh:MM:ss')}}
						</view>	
					</view>
				</view>
			</view>
		</u-card>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				logList: [],
				loading: false,
				nickname: uni.getStorageSync('userInfo').nickname,
				username: uni.getStorageSync('userInfo').username,
			};
		},
		methods: {
			//列表
			initData() {
				this.loading = true;
				uni.request({
						url: `http://192.168.2.149:3000/seats/listSeatlog?page=&limit=&nickname=${this.nickname}&username=${this.username}`,
						method: "GET"
					})
					.then((res) => {
						console.log(res)
						if (res[1].data.status === "ok") {
							this.logList = res[1].data.data;
							console.log(this.logList, 444)			
						} else {
							this.$refs.uToast.show({
								title: '获取信息失败',
								type: 'error',
								position: 'top',
							})
						}
						this.loading = false;
					})
			},
		},
		onLoad() {
			this.initData()
		},
		onReady(){
			this.initData()
		},
	}
</script>

<style scoped lang="scss">
	.u-card-wrap {
		background-color: $u-bg-color;
		padding: 1px;
	}

	.u-body-item {
		font-size: 32rpx;
		color: #333;
		padding: 20rpx 10rpx;
	}

	.u-body-item image {
		width: 120rpx;
		flex: 0 0 120rpx;
		height: 150rpx;
		border-radius: 8rpx;
		margin-left: 12rpx;
	}
	
	.height-50{
		height: 100rpx;
	}
</style>
